//
//  JMConfigure.m
//  VoluntaryStar
//
//  Created by xiaorui on 15/8/31.
//  Copyright (c) 2015年 ios. All rights reserved.
//

#import "JMConfigure.h"
#import "JMAppKey.h"
#import "NSString+date.h"
#import <OpenUDID.h>



@implementation JMConfigure

+(instancetype) sharedConfigureManger{
    static JMConfigure *sharedConfigure =nil;
    static dispatch_once_t predicate;
    dispatch_once(&predicate, ^{
        sharedConfigure = [[self alloc]init];
    
    });
    return sharedConfigure;
}
/**
 * 设备加密
 **/
-(NSString *)deviceString{
    return [[OpenUDID value] JMMD5String];
}
/**
 * 项目 签名
 **/
-(NSString *)signString{
    return  [[NSString stringWithFormat:@"%@%@",JMPrivateKey,self.deviceString] JMMD5String];
}
/**
 * 项目ID
 **/
-(NSString *)projectID{
    return JMProjectKey;
};
/**
 *经度
 **/
-(NSString *)longitudeX{
    return nil;
};
/**
 *纬度
 **/
-(NSString *)latitudeY{
    return nil;
};
/**
 * ip 地址
 **/
- (NSString *)ipString{
        return nil;
}

- (JMUser *)user
{
    NSString *documents = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];
    NSString *path = [documents stringByAppendingPathComponent:@"person.archiver"];
  
    JMUser *user = [NSKeyedUnarchiver unarchiveObjectWithFile:path];
    NSLog(@"%@,%@",user.nicheng,user.grade);
    if(user){
        return user;
    }else{
        return nil;
    }
}

@end
